 

package com.zdkj.subway.rca.controller;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.zdkj.common.core.util.R;

import com.zdkj.subway.rca.entity.SwCkClearRules;
import com.zdkj.subway.rca.entity.SwCkClearRulesLine;
import com.zdkj.subway.rca.service.SwCkClearRulesLineService;
import com.zdkj.subway.rca.service.SwCkClearRulesService;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import org.springframework.beans.factory.annotation.Autowired;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;


/**
 * 清分规则各线路占比管理
 *
 * @author stw
 * @date 2020-12-02 19:26:39
 */
@RestController
@AllArgsConstructor
@RequestMapping("/swckclearrulesline" )
@Api(value = "swckclearrulesline", tags = "清分及划账-清分规则管理")
public class SwCkClearRulesLineController {
    @Autowired
    private final SwCkClearRulesLineService swCkClearRulesLineService;
    @Autowired
    private final SwCkClearRulesService swCkClearRulesService;
    /**
     * 清分规则各线路占比浏览
     * @param id  主表规则ID
     * @return
     */
    @ApiOperation(value = "清分规则各线路占比预览", notes = "清分规则各线路占比预览")
    @GetMapping("/previewLine" )
    @ApiImplicitParams(
            {
                    @ApiImplicitParam(name = "id", value = "规则ID", dataTypeClass = Long.class, required = true),
            }
    )
    public R previewLine(Long id) {
        SwCkClearRules swCkClearRules = swCkClearRulesService.getById(id);
        SwCkClearRulesLine swCkClearRulesLine = new SwCkClearRulesLine();
        swCkClearRulesLine.setRuleId(swCkClearRules.getUuid());
        swCkClearRulesLine.setDelFlag("0");
        return R.ok(swCkClearRulesLineService.list(Wrappers.query(swCkClearRulesLine)));
    }


}
